<template>
  <div class="dashboard-container">
    <div class="dashboard-text">name:{{userInfo.realname}}</div>
  </div>
</template>

<script>
import axios from '@/http/axios'
export default {
  data(){
    return {
      userInfo:{}
    }
  },
  created(){
    var token = localStorage.getItem('token')
    this.findUserInfo(token)
  },
  methods:{
    findUserInfo(token){
      var obj = {
        token
      }
      axios({
        url:'http://121.199.29.84:8001/user/info',
        method:'get',
        params:obj
      }).then((res)=>{
        this.userInfo = res.data.data
        // 把用户头像存放到浏览器
        localStorage.setItem('userFace',res.data.data.userFace)
      })
    }
  }
}
</script>

<style lang="scss" scoped>
.dashboard {
  &-container {
    margin: 30px;
  }
  &-text {
    font-size: 30px;
    line-height: 46px;
  }
}
</style>
